<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>HTML5——坦克大战</title>
    <script>
      if (
        /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
          navigator.userAgent
        )
      ) {
        // 如果检测到是移动设备，重定向到另一个页面或者显示一个警告
        window.location.href = "404.html";
      }
      document.addEventListener("DOMContentLoaded", function () {
        document.addEventListener(
          "keydown",
          function (event) {
            // 检查是否是方向键
            if (
              event.key === "ArrowUp" ||
              event.key === "ArrowDown" ||
              event.key === "ArrowLeft" ||
              event.key === "ArrowRight"
            ) {
              // 阻止默认行为（滚动）
              event.preventDefault();
            }
          },
          false
        );
      });
    </script>
    <style>
      .back-link {
        display: inline-block;
        padding: 10px 20px;
        background-color: #4caf50;
        color: white;
        text-decoration: none;
        border-radius: 4px;
        transition: background-color 0.3s ease;
      }

      .back-link:hover {
        background-color: #45a049;
      }
    </style>
  </head>

  <body>
    <div
      id="main"
      style="text-align: center; margin-left: auto; margin-right: auto"
    ></div>
  </body>

  <script type="text/javascript" src="js/tank.js"></script>
  <script>
    window.onload = function () {
      document.getElementById("main").appendChild(canvas);
      init();
    };
  </script>
</html>
